﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Web.SystemLogin.Business;
using System.Web.Security;
using System.Threading;
using DreamBuilder.Core.Container;
using DreamBuilder.Core.Log;
using CommonModule;

namespace Web.Views.SystemLogin
{
    public partial class Logout : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.DBHelpName = DBHelperString.Dictionary;
            OnlineUser ou = new OnlineUser();
            ou.DelelteOnline(Session.SessionID);

            #region 记录登出日志
            try
            {
                ILogger log = UContainer.Resolve<ILogger>(Category.LogoutLog);
                log.Info(ou.GetLogInfo(base.CurrentUser.User_ID, base.CurrentUser.User_Name,Request.UserHostAddress, Request.Browser.Platform, Thread.CurrentThread.CurrentUICulture.Name, Request.Browser.Type));
            }
            catch (Exception ex) { }
            #endregion

            Session.RemoveAll();
            Session.Abandon();
            FormsAuthentication.SignOut();

            Server.Transfer("SystemLogin.aspx");
            //this.Response.Redirect("http://www.bgp.cnpc/sites/rf/default.aspx");
            //this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "logout();", true);
        }
    }
}
